package heima3_2.cn.osc.hold;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import net.oschina.app.R;

import butterknife.Bind;
import butterknife.ButterKnife;
import heima3_2.cn.osc.base.BaseHolder;

import heima3_2.cn.osc.base.MyBaseAdapter;
import heima3_2.cn.osc.model.bean.EventBean;
import heima3_2.cn.osc.ui.activity.EventprehensiveActivity;


/**
 * Created by emily on 2017/1/16.
 */
public class ExeriseHotHolder extends BaseHolder<EventBean> {

    @Bind(R.id.im_exercise)
    ImageView imExercise;
    @Bind(R.id.tv_exercise_title)
    TextView tvExerciseTitle;
    @Bind(R.id.tv_exercise_time)
    TextView tvExerciseTime;
    @Bind(R.id.tv_exercise_content)
    TextView tvExerciseContent;
    private EventBean mBean;

    public ExeriseHotHolder(Context context, ViewGroup parent, MyBaseAdapter<EventBean> adapter, int position, EventBean bean) {
        super(context, parent, adapter, position, bean);
    }


    @Override
    public View onCreateView(final Context context, ViewGroup parent, int position, EventBean bean) {
        this.mBean=bean;
        View viewItem = View.inflate(context, R.layout.find_fragment_exercise__recently_item, null);
        ButterKnife.bind(this,viewItem);
        final int EXERISE=2;
        viewItem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(context, EventprehensiveActivity.class);
                intent.putExtra("EVENT_EXERISE",EXERISE);
                Bundle bundle=new Bundle();
                bundle.putSerializable("EXERISE",mBean);
                intent.putExtras(bundle);
                context.startActivity(intent);
            }
        });
        return viewItem;
    }

    @Override
    protected void onRefreshView(EventBean bean, int position) {
        tvExerciseTitle.setText(bean.getTitle());
        tvExerciseTime.setText(bean.getStartTime());
        tvExerciseContent.setText(bean.getSpot());
        



    }
}
